<template>
  <div class="basic_info">
    <div class="info_operation_btn">
      <div class="btn_left">
        <el-button type="primary" @click="onRefresh">统计</el-button>
        <el-button @click="exportExcel()" :disabled="!buttonsPermissions.DaoChu || !pricePerm"
          :class="!buttonsPermissions.DaoChu ? 'disabled_button' : ''">导出</el-button>
        <el-button :disabled="!buttonsPermissions.DaYin" :class="!buttonsPermissions.DaYin ? 'disabled_button' : ''"
          @click="handleShortcutKeyPrint">打印(P)</el-button>
        <el-checkbox v-model="isShowStorehouseGroupInfo" @change="typeChange">显示商品类别的统计结果</el-checkbox>
      </div>
      <div class="btn_right">
        <el-input v-model="queryData.keywords" placeholder="请输入商品名称\条码\编码\规格\拼音码"></el-input>
        <el-button type="primary" @click="search">搜索</el-button>
        <i @click="onShowColumn()" class="set_up el-icon-s-tools"></i>
      </div>
    </div>
    <div class="info_content_div">
      <div class="div_table">
        <div class="div_tree">
          <div class="tree_div1">
            <span>商品类别</span>
          </div>
          <div class="tree_input">
            <p>
              <input type="text" placeholder="查找" v-model="filterText" />
              <span>
                <i class="el-icon-search"></i>
              </span>
            </p>
          </div>
          <div class="tree_structure">
            <el-tree ref="tree" :data="treeData" :props="defaultProps" @node-click="handleClick"
              :filter-node-method="filterNode"></el-tree>
          </div>
        </div>
        <div class="table_content">
          <el-table ref="tableData" show-summary :summary-method="getSummaries" highlight-current-row :header-cell-style="{
            background: '#E3F6FF',
            color: '#666666',
            textAlign: 'center',
            height: '30px',
            borderColor: '#dddddd',
          }" border  :data="tableData" style="width: 100%" height="100%" @sort-change="changeSort"
            @row-dblclick="handleRowDbclick">
            <template v-for="(item, index) in columnDataShow">
              <el-table-column :label="item.label" v-if="item.show" :key="index">
                <el-table-column :resizable="false" v-if="!index == 1" label="序号" type="index" />
                <template v-for="(v, i) in item.subset">
                  <el-table-column border :show-overflow-tooltip="true" v-if="v.zidingyiState" :key="i" :prop="v.props"
                    :label="v.zidingyiName ? v.zidingyiName : v.morenName" min-width="120px"
                    :resizable="v.props=='goodsName'?true:false"
                    :width="v.props == 'xh' ? '50px' : v.props == 'spbh' ? '170px':''"
                    :sortable="v.zidingyiSort == 1">
                    <template slot-scope="scope">
                  <span v-if="v.props == 'goodsName'" style="width: 100%; white-space: normal;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; text-align: left;">{{ scope.row[v.props] }}</span>
                  <span v-else>{{ scope.row[v.props] }}</span>
                </template>
                  </el-table-column>
                </template>
                
              </el-table-column>
            </template>
          </el-table>
        </div>
      </div>
      <div class="table_pagination">
        <div class="pagination_div">
          <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="queryData.pageNo" :page-sizes="[20, 50, 100, 200]" :page-size="queryData.pageSize"
            layout="jumper, prev, pager,next, sizes" :total="total"></el-pagination>
        </div>
      </div>
    </div>
    <!-- 列配置弹框 -->
    <CConfiguration ref="setColumnRef" :columnDataArr="columnData" orderType="库存分布查询"
      :defaultColumnDataArr="defaultColumnData" @onSaveColumn="onSaveColumn">
    </CConfiguration>
    <!-- 打印 -->
    <dialog-print ref="print"></dialog-print>
  </div>
</template>

<script>
import { getAction } from '@/api/manage'
import { mapGetters } from 'vuex'
import CConfiguration from '@/components/c_column/columnConfiguration1'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { cloneObject } from '@/utils/util'
/**打印 */
import dialogPrint from '@/views/components/dialogPrintStatic'
// 导入调用处理权限数据方法
import { handlePermissions, handleOtherPerms, formatMoney, formatPrice, formatNumber, delcommafy } from '@/utils/index'
export default {
  name: 'inventoryDistributeQuery',
  components: {
    CConfiguration,
    dialogPrint,
  },
  mixins: [JeecgListMixin],
  computed: {
    ...mapGetters(['name']),
    buttonsPermissions() {
      return handlePermissions('库存分布查询')
    },
    printPermissions() {
      return handleOtherPerms('单据可多次打印')
    },
  },
  updated() {
    this.$nextTick(() => {
      this.$refs.tableData.doLayout()
    })
  },
  created() {
    this.getTreeData()
  },
  data() {
    return {
      filterText: '',
      // 总数量
      total: 0,
      // tree查找
      GoodsTypeName: '',
      // 查询条件数据
      queryData: {
        pageNo: 1,
        pageSize: 20,
        // 搜索
        keywords: '',
        // 商品类别id
        goodsTypeId: '',
        // 商品类别名
        goodsTypeName: '全部',
      },
      // 显示商品类别的统计结果
      isShowStorehouseGroupInfo: false,
      defaultProps: {
        children: 'children',
        label: 'label',
      },
      isShowDate: true, // 是否显示选择时间组件
      nowDate: [],
      // 表格数据
      tableData: [],
      // 列配置数据
      columnData: [
        {
          props: 'spxx',
          label: '商品信息',
          show: true,
          morenState: true,
          subset: [
            {
              id: '2',
              morenName: '商品编码',
              zidingyiName: '',
              morenState: true,
              zidingyiState: true,
              zidingyiSort: 1,
              noModify: false,
              props: 'goodsNumber',
            },
            {
              id: '3',
              morenName: '商品名称',
              zidingyiName: '',
              morenState: true,
              zidingyiState: true,
              zidingyiSort: 0,
              noModify: false,
              props: 'goodsName',
            },
            {
              id: '4',
              morenName: '规格',
              zidingyiName: '',
              morenState: true,
              zidingyiState: true,
              zidingyiSort: 1,
              noModify: false,
              props: 'specs',
            },
            {
              id: '5',
              morenName: '单位',
              zidingyiName: '',
              morenState: true,
              zidingyiState: true,
              zidingyiSort: 1,
              noModify: false,
              props: 'baseUnit_dictText',
            },
            {
              id: '6',
              morenName: '条形码',
              zidingyiName: '',
              morenState: true,
              zidingyiState: true,
              zidingyiSort: 1,
              noModify: false,
              props: 'barCode',
            },
          ],
        },
      ],
      columnDataShow: [], // 用于显示的列配置
      defaultColumnData: [],// 默认列配置
      columnKey: '库存分布查询',// 列配置的标识key
      updateId: '', // 修改列配置时返回的id
      lookupValue: '', //类别查找值
      // tree类别数据
      treeData: [],
      batchData: [], // 存储多选的数据
      showLiepeizhi: false, //是否显示列配置
      url: {
        exportXlsUrl: '/xghStorehouseGoods/xghStorehouseGoods/storehouseGoodsExport'
      }, // 导出地址
      billName: '库存分布查询',
      pricePerm: true, // 成本价格权限
    }
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    }
  },
  mounted() {
    // 初始化列配置数据
    this.defaultColumnData = JSON.parse(JSON.stringify(this.columnData))
    this.selectTitle()
  },
  methods: {
    // 打印
    async handleShortcutKeyPrint() {
      // 查询
      let params = {
        ...this.queryData,
        groupByGoodsTypeFlag: this.isShowStorehouseGroupInfo ? '1' : '0', //0-不显示 1-显示
        pageNo: 1,
        pageSize: 1000000,
      }
      let printExclusive = []
      const res = await getAction('/xghStorehouseGoods/xghStorehouseGoods/storehouseGoodsByStorehouse2', params)
      if (res.code == 200) {
        printExclusive = res.result.records || []
        if (printExclusive.length > 0) {
          // 重新设置列配置
          this.columnData[0].morenState = true
          this.columnDataShow = cloneObject(this.columnData)
        }
        printExclusive.forEach((item, itemIndex) => {
          // 处理仓库对应的数据
          item.storehouseVoList.forEach((val, index) => {
            // 添加列信息只需要添加一次
            if (itemIndex === 0) {
              // 组装仓库的列信息
              let columnObj = {
                props: 'storehouse' + index,
                label: val.storehouseName,
                morenState: true,
                show: true,
                subset: [{
                  id: '1',
                  morenName: '数量',
                  zidingyiName: '',
                  morenState: true,
                  zidingyiState: true,
                  zidingyiSort: 1,
                  noModify: false,
                  props: 'opNumber' + index,
                }, {
                  id: '2',
                  morenName: '金额',
                  zidingyiName: '',
                  morenState: true,
                  zidingyiState: true,
                  zidingyiSort: 1,
                  noModify: false,
                  props: 'storePrice' + index,
                }]
              }
              // 将组装好的列信息存储到列配置数组中
              this.columnDataShow.push(columnObj)
            }
            // 添加对应列的数据
            item['opNumber' + index] = formatNumber(val.opNumber)
            item['storePrice' + index] = val.storePrice == '******' ? '******' : formatMoney(val.storePrice)
          })
        })
      }
      // 打印
      if (!this.buttonsPermissions.DaYin) {
        this.$elMessage.warning('未拥有打印权限！')
      } else if (!printExclusive || printExclusive.length <= 0) {
        this.$elMessage.warning('没有要打印的记录！')
      } else {
        let printData = {
          goodstype: this.queryData.goodsTypeName,
          printExclusive,
        }
        // 可以多次打印设置
        if (this.printPermissions) {
          this.$refs.print.show(printData, this.columnDataShow, this.billName)
        } else {
          if (this.$lcStorage.get('printLimitValue')) {
            // 获取打印次数
            this.getPrintNum(this.billName, (() => {
              this.$refs.print.show(printData, this.columnDataShow, this.billName)
            }))
          } else {
            this.$refs.print.show(printData, this.columnDataShow, this.billName)
          }
        }
      }
    },
    //类别筛选
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    /**
     * 表格数据
     */
    async listTableData() {
      let params = {
        ...this.queryData,
        groupByGoodsTypeFlag: this.isShowStorehouseGroupInfo ? '1' : '0' //0-不显示 1-显示
      }
      const res = await getAction('/xghStorehouseGoods/xghStorehouseGoods/storehouseGoodsByStorehouse2', params)
      if (res.code == 200) {
        this.total = res.result.total
        let storehouseDatas = res.result.records || []
        if (storehouseDatas.length > 0) {
          // 重新设置列配置
          this.columnDataShow = cloneObject(this.columnData)
        }
        storehouseDatas.forEach((item, itemIndex) => {
          // 处理仓库对应的数据
          item.storehouseVoList.forEach((val, index) => {
            // 添加列信息只需要添加一次
            if (itemIndex === 0) {
              // 组装仓库的列信息
              let columnObj = {
                props: 'storehouse' + index,
                label: val.storehouseName,
                show: true,
                morenState: true,
                subset: [{
                  id: '1',
                  morenName: '数量',
                  zidingyiName: '',
                  morenState: true,
                  zidingyiState: true,
                  zidingyiSort: 1,
                  noModify: false,
                  props: 'opNumber' + index,
                }, {
                  id: '2',
                  morenName: '金额',
                  zidingyiName: '',
                  morenState: true,
                  zidingyiState: true,
                  zidingyiSort: 1,
                  noModify: false,
                  props: 'storePrice' + index,
                }]
              }
              // 将组装好的列信息存储到列配置数组中
              this.columnDataShow.push(columnObj)
            }
            // 添加对应列的数据
            item['opNumber' + index] = formatNumber(val.opNumber)
            item['storePrice' + index] = val.storePrice == '******' ? '******' : formatMoney(val.storePrice)
            this.pricePerm = val.storePrice == '******' ? false : true
          })
        })
        this.tableData = storehouseDatas
      }
    },
    /**
     * 刷新
     */
    onRefresh() {
      Object.assign(this.$data, this.$options.data())
      // 初始化列配置数据
      this.defaultColumnData = JSON.parse(JSON.stringify(this.columnData))
      this.selectTitle()
      this.getTreeData()
      this.listTableData()
    },
    /**
     * 搜索
     */
    search() {
      this.listTableData()
    },
    /**
     * 盘点仓库选项事件
     */
    handleSelect() {
      this.listTableData()
    },
    /**
     * 选择过滤信息
     */
    handleFilterSelect() {
      this.listTableData()
    },
    typeChange() {
      this.listTableData()
    },
    statusChange() {
      this.listTableData()
    },
    /**
     * 搜索树形结构数据
     */
    onSelectTree() {
      this.getTreeData()
    },
    /**
     * 统计
     */
    statistics() {
      this.listTableData()
    },
    /**
     * tree树被点击
     */
    handleClick(rowData) {
      this.queryData.goodsTypeId = rowData.id
      this.queryData.goodsTypeName = rowData.label
      this.queryData.pageNo = 1
      // 点击的每一个tree树的信息对象
      this.listTableData()
    },
    /**
     * 获取tree数据
     */
    getTreeData() {
      getAction('/xghGoodsType/xghGoodsType/typeList', {}).then((res) => {
        if (res.code === 200) {
          let list = res.result
          let result = this.getTreeDataByList(list, '0', '')
          this.treeData = [{
            id: '',
            label: '全部',
            children: result
          }]
        }
      })
    },
    getTreeDataByList(list, parentId, parentName) {
      let data = []
      for (let index = 0; index < list.length; index++) {
        const element = list[index];
        if (element.pid == parentId) {
          data.push({
            ...element,
            id: element.id,
            label: element.goodsTypeName,
            parentId,
            parentName,
            children: this.getTreeDataByList(list, element.id, element.companyTypeName)
          })
        }
      }
      return data
    },
    /**
     * 处理表格每一个行
     */
    handleRowDbclick(row) {
      if (this.isShowStorehouseGroupInfo) {
        return this.showTips('商品类别结果不能查看明细！')
      }
      this.$router.push({
        name: 'reportStatistics-inventoryReport-inventoryChange', //库存变更明细
        params: {
          goodsId: row.id,
          goodsName: row.goodsName,
          storehouseId: '',
          storehouseName: ''
        },
      })
    },
    // 请求筛选条件数据
    requestQuery(obj) {
      console.log(obj, '请求')
    },
    // 从后台获取数据,重新排序
    changeSort(val) {
      console.log(val) // column: {…} order: "ascending" prop: "date"
      // 根据当前排序重新获取后台数据,一般后台会需要一个排序的参数
      if (val.order) {
        //ascending 升序   descending 降序
        this.queryData.orderColumn = val.prop
        this.queryData.orderType = val.order == 'ascending' ? 1 : 2
        this.listTableData()
      } else {
        this.queryData.orderColumn = undefined
        this.queryData.orderType = undefined
        this.listTableData()
      }
    },
    // 触发表格多选按钮
    handleSelectionChange(val) {
      this.batchData = val
    },
    // 触发列配置弹框
    onShowColumn() {
      // 现在的列配置
      let list = []
      this.columnData.forEach(item => {
        let sub = item.subset
        list = list.concat(sub)
      })
      // 默认的列配置
      let defaultList = []
      this.defaultColumnData.forEach(item => {
        let sub = item.subset
        defaultList = defaultList.concat(sub)
      })
      this.$refs.setColumnRef.loadData(list, defaultList)
    },
    // 查询保存的列配置
    async selectTitle() {
      let obj = await this.$setColumn.selectColumn(this.columnKey)
      if (obj.code === 200) {
        this.updateId = obj.updateId
        this.columnData = obj.columnData
      } else if (obj.code === 500) {
        let id = await this.$setColumn.addColumn(this.columnKey, this.defaultColumnData, 'props')
        this.updateId = id
        this.columnData = this.defaultColumnData
      } else if (obj.code === 404) {
        this.columnData = this.defaultColumnData
      }
      // 保证列配置生效
      this.listTableData()
    },
    // 修改列配置后保存修改后的值
    async onSaveColumn(value) {
      let nIndex = 0
      this.columnData.forEach((lItem, lIndex) => {
        let subList = lItem.subset
        if (lIndex > 0) {
          nIndex += this.columnData[lIndex - 1].subset.length
        }
        let list = []
        let count = 0 //记录隐藏的个数
        subList.forEach((item, index) => {
          let nItem = value[nIndex + index]
          list.push(nItem)
          if (!nItem.zidingyiState) {
            count++
          }
        })
        lItem.subset = list
        lItem.show = !(count == list.length)
        this.columnData.splice(lIndex, 1, lItem)
        this.columnDataShow.splice(lIndex, 1, lItem)
      })
      this.onSaveColumnRequest()
    },
    // 修改列配置后保存修改后的值
    async onSaveColumnRequest() {
      let res = await this.$setColumn.editColumn(this.columnKey, this.columnData, this.updateId)
      if (res.code == 200) {
        this.showTips(res.message, 0)
      } else {
        this.showTips(res.message, 2)
      }
    },
    // 合计列计算
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      var that = this
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
        } else if (index === 1) {
          sums[index] = '共' + that.total + '条明细'
        } else if (column.property.includes('opNumber') || column.property.includes('storePrice')) {
          const values = data.map((item) => delcommafy(item[column.property]))
          if (!values.every((value) => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = delcommafy(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
            if (column.property.includes('opNumber')) {
              sums[index] = formatNumber(sums[index]) // 保留2位小数，解决小数列合计精度缺失的问题
            } else {
              sums[index] = formatMoney(sums[index]) // 保留2位小数，解决小数列合计精度缺失的问题
            }
          }
        } else {
          sums[index] = ''
        }
      })
      return sums
    },
    // 获取每页几条数据
    handleSizeChange(val) {
      this.queryData.pageSize = val
      this.listTableData()
    },
    // 获取当前第几页
    handleCurrentChange(val) {
      this.queryData.pageNo = val
      this.listTableData()
    },
    // 导出数据
    exportExcel() {
      const fileName = '库存分布查询'
      let params = {
        ...this.queryData,
        groupByGoodsTypeFlag: this.isShowStorehouseGroupInfo ? '1' : '0',//0-不显示 1-显示
        fileName
      }
      this.handleExportXlsByStaff(fileName, params)
    },
    showTips(msg, type = 1) {
      switch (type) {
        case 0:
          this.$elMessage.success(msg)
          break;
        case 1:
          this.$elMessage.warning(msg)
          break;
        case 2:
          this.$elMessage.error(msg)
          break;
      }
    },
  },
}
</script>

<style lang="scss" scoped>
.basic_info {
  width: 100%;
  height: calc(100vh - 102px);
  background: #f0f2f5;
  box-sizing: border-box;
  padding: 0 0.168761rem 0.168761rem;
  display: flex;
  flex-direction: column;
}

.info_operation_btn {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;

  ::v-deep .el-button {
    width: 80px;
    height: 30px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 0.1rem;
    border: none;
    margin-right: 6px;
    margin-left: 0;
  }

  .el-button--default {
    color: #666;
  }

  .btn_left {
    width: 60%;
    display: flex;
    justify-content: flex-start;
    align-items: center;

    ::v-deep .el-checkbox {
      .el-checkbox__label {
        font-size: 12px;
        padding-left: 0.1rem;
        color: #666;
      }
    }
  }

  .btn_right {
    width: 40%;
    display: flex;
    justify-content: flex-end;
    align-items: center;

    .el-input {
      width: 4.725295rem;
      height: 30px;
      margin-right: 0.112507rem;

      ::v-deep .el-input__inner {
        height: 30px;
        border: none;
        box-sizing: border-box;
        padding: 0 0.15rem;
        background: #fff;
        font-size: 12px;
        color: #666;

        &::placeholder {
          font-size: 12px;
          color: #c1c1c1;
        }
      }
    }

    .set_up {
      font-size: 23px;
      color: rgb(153, 153, 153);
    }
  }
}

.info_content_div {
  width: 100%;
  height: calc(100% - 50px);
  background: #fff;
  box-sizing: border-box;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  .div_table {
    width: 100%;
    height: calc(100% - 50px);
    display: flex;
    box-sizing: border-box;

    .div_tree {
      width: 180px;
      height: 100%;
      box-sizing: border-box;
      padding: 6px 0;
      border: 1px solid #e3e3e3;
      transition: all 0.3s;

      .tree_div1 {
        width: 100%;
        height: 20px;
        box-sizing: border-box;
        padding: 0 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;

        p {
          color: #666666;
          font-size: 12px;
        }
      }

      .tree_input {
        width: 100%;
        height: 30px;
        margin-top: 10px;
        box-sizing: border-box;
        padding: 0 6px;

        p {
          width: 100%;
          height: 30px;
          margin: 0;
          box-sizing: border-box;
          border: 1px solid #dddddd;
          display: flex;
          align-items: center;
          position: relative;

          input {
            width: 100%;
            box-sizing: border-box;
            padding: 0 33px 0 5px;
            height: 28px;
            border: none;
            font-size: 12px;

            &:focus {
              outline: none;
            }
          }

          span {
            position: absolute;
            right: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 0.55rem;
            height: 28px;
            background: #fff;

            .el-icon-search {
              font-size: 12px;
              color: rgb(211, 211, 211);
            }
          }
        }
      }

      .tree_structure {
        width: 100%;
        height: calc(100% - 0.337521rem - 0.131258rem - 0.131258rem - 0.55rem);
        box-sizing: border-box;
        padding: 0 0.168761rem;
        margin-top: 0.131258rem;
        overflow: auto;

        ::v-deep .el-tree {
          width: 100%;

          .el-tree-node__children {
            .el-tree-node__label {
              color: #666;
              font-weight: normal;
            }
          }

          .el-tree-node__label {
            font-size: 12px;
            font-weight: 600;
          }

          .el-tree-node__content>.el-tree-node__expand-icon {
            padding-left: 0;
          }
        }
      }
    }

    .table_content {
      width: calc(100% - 180px);
      margin-left: 10px;
      height: 100%;

      ::v-deep .el-table {
        border: 1px solid #e3e3e3;
        box-sizing: border-box;

        th,
        td {
          padding: 0;
          color: #666;
          box-sizing: border-box;
          border-right: 1px solid #e3e3e3;
          min-height:30px ;

          &:first-child {
            .cell {
              display: flex;
              justify-content: center;
            }
          }

          &:last-child {
            border-right: none;
          }
        }

        .el-table-column--selection {
          .cell {
            padding: 0;
            text-align: center;
            min-height: 30px;
          }
        }

        .el-table__header {
          tr {
            &:last-child {
              th {
                background: rgb(237, 237, 237) !important;
              }
            }
          }
        }

        .cell {
          line-height: 30px;
          font-size: 12px;
        }

        .el-table__body tr:hover>td {
          background: #e3f6ff;
        }

        .el-table__footer-wrapper {
          td {
            background: #f4f4f4;
            border: none;
            font-weight: 500;
            font-family: PingFang SC;
            // text-align: center;
          }
        }

        //滚动条的宽度
        ::-webkit-scrollbar {
          width: 8px;
          height: 10px;
          background-color: #e5e5e5;
        }

        //滚动条的滑块
        ::-webkit-scrollbar-thumb {
          background-color: #c9c9c9;
        }
      }
    }
  }

  .table_pagination {
    width: 100%;
    height: 50px;
    box-sizing: border-box;
    padding: 10px 0;
    display: flex;

    .pagination_div {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: flex-end;

      ::v-deep .el-pagination {
        padding: 0;
        height: 30px;

        .el-pagination__sizes {
          margin: 0;

          .el-input {
            margin-right: 0;
          }
        }
      }
    }
  }
}
</style>